<?php
######################################################################
# SmallNuke: Advanced Content Management System
# ============================================
# Copyright (c) 2004 by Sergey Vipolzov (info@smallnuke.com)
# http://smallnuke.com
# ============================================
# Developed from the PHP-Nuke 7.0
# Copyright (c) 2002 by Francisco Burzi
# http://phpnuke.org/
# ============================================
# This program is free software. You can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License.
######################################################################

if (eregi("block-Pages.php", $_SERVER['PHP_SELF'])) {
    Header("Location: index.php");
    die();
}


global $prefix, $db, $themepath, $c;

$images = "<img src=\"".$themepath."modules/Pages/images/minus.gif\">";
$images2 = "<img src=\"".$themepath."modules/Pages/images/plus.gif\">";
$content = "";
$sql = "SELECT cid, title FROM ".$prefix."_smallpages_categories where parentid=0 order by cid, parentid";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$cid = $row[cid];
$title = $row[title];
$num = $db->sql_numrows($db->sql_query("SELECT cid FROM ".$prefix."_smallpages_categories WHERE parentid='$cid' limit 1"));
if ($num == 0) {
$content .= "$images <a Style=\"cursor: hand; TEXT-DECORATION: none;\" href=\"".$themepath."modules.php?name=Pages&amp;go=showcat&amp;cid=$cid\">$title</a><br>";
}
else {
$content .= "$images2 <a Style=\"cursor: hand; TEXT-DECORATION: none;\" href=\"".$themepath."modules.php?name=Pages&amp;go=showcat&amp;cid=$cid\">$title</a><br>";
       }
}

?>
